/**  
 * All rights Reserved, Designed By <a href="www.itttq.com" target="_blank">www.itttq.com</a>
 * @date:   2017-07-21 11:42:21
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */
package com.itttq.gshop.pbpm.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.itttq.gshop.domain.po.SysFieldPo;
import com.itttq.gshop.domain.to.ResultPageTo;
import com.itttq.gshop.pbpm.mapper.ISysFieldMapper;

@Service
public class SysFieldService {
	@Autowired
	private ISysFieldMapper sysFieldMapper;
	
	/**
	 * 根据ID获取SysFieldPo对象
	 * 
	 * @param id
	 * @return
	 * @Author 迷蝶
	 * @return SysFieldPo
	 */
	public SysFieldPo getSysField(int id) {
		return sysFieldMapper.findSysFieldById(id);
	}
	
	/**
	 * 根据条件获取SysFieldPo对象，并返回查询的数据总数
	 * 
	 * @param sysField
	 * @Author 迷蝶
	 * @return ResultPageTo<SysFieldPo>
	 */
	public ResultPageTo<SysFieldPo> getSysFields(SysFieldPo sysField) {
		return new ResultPageTo<SysFieldPo>(sysField.getStart(), sysField.getSize(), 
				sysFieldMapper.findSysFieldCount(sysField), sysFieldMapper.findSysFields(sysField));
	}
	
	/**
	 * 根据ID删除SysFieldPo对象
	 * 
	 * @param id
	 * @Author 迷蝶
	 */
	public Integer delSysField(int id) {
		return sysFieldMapper.delSysFieldById(id);
	}
	
	/**
	 * 增加SysFieldPo对象
	 * 
	 * @param sysField
	 * @Author 迷蝶
	 */
	public Integer addSysField(SysFieldPo sysField) {
		return sysFieldMapper.addSysField(sysField);
	}
	
	/**
	 * 根据条件更新SysFieldPo对象
	 * 
	 * @param sysField
	 * @Author 迷蝶
	 */
	public Integer updateSysField(SysFieldPo sysField) {
		return sysFieldMapper.updateSysField(sysField);
	}
	
}
